package com.epro.dx.activity.creditcard;

import android.net.http.SslError;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.epro.dx.R;
import com.epro.dx.activity.BaseFragmentActivity;
import com.google.android.gms.analytics.Tracker;
import com.weipu.common.DXApplication;
import com.weipu.common.DXApplication.TrackerName;
import com.weipu.common.util.GlobalConfig;
import com.weipu.common.util.Logger;

/**
 *  PCI description
 * 
 * @author  hf
 * @version  [版本号, 2016-2-23]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public class CreditCardPciActivity extends BaseFragmentActivity
{
    private WebView webView;
    
    
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        //设置窗体无标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_infochild);
        setLeftBtnContent(true, -1);
        initwebview();
        //GA
        sendScreen();
    }
    
    private void initwebview()
    {
        webView = (WebView)findViewById(R.id.webView);
        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        //自适应屏幕
        webView.getSettings().setUseWideViewPort(true); 
        webView.getSettings().setLoadWithOverviewMode(true);

        webView.setWebViewClient(new WebViewClient()
        {
            //跳过HTTPS验证
            @Override
            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
            {
            	if(GlobalConfig.getInstance().isCheckSSL()){
            		handler.proceed();
            	}else{
            		handler.cancel();
            	}
            }
            
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
            	view.loadUrl(url); 
            	return super.shouldOverrideUrlLoading(view, url);
            }
            
        });
        webView.setWebChromeClient(new WebChromeClient()
        {
            @Override
            public void onProgressChanged(WebView view, int newProgress)
            {
            }
        });
                setTitleContent("PCI");
                webView.loadUrl("http://www.atsec.cn/cn/pci-attestation/EPRO-PCIAttestation-atsec-PCI-DSS-C-01418.jpg");
    }
               
    
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        if (keyCode == KeyEvent.KEYCODE_BACK)
        {
            if (null != webView && webView.canGoBack())
            {
                webView.stopLoading();
                webView.goBack();
            }
            else
            {
                this.finish();
            }
        }
        return true;
    }
}
